<template>
	<view>
		<view class="u-text-center u-margin-20 u-font-lg">
			<text>今日提交</text>
		</view>
		<view>
			<u-table>
				<u-tr class="u-tr">
					<u-th class="u-th">返沙人数</u-th>
					<u-th class="u-th">接种人数</u-th>
					<u-th class="u-th">购药人数</u-th>
				</u-tr>
				<u-tr class="u-tr">
					<u-td class="u-td">{{ list.count1 }}人</u-td>
					<u-td class="u-td">{{ list.count2 }}人</u-td>
					<u-td class="u-td">{{ list.count3 }}人</u-td>
				</u-tr>
			</u-table>
		</view>
		<view class="u-text-center u-margin-20 u-margin-top-50 u-font-lg">
			<text>昨日提交</text>
		</view>
		<view>
			<u-table>
				<u-tr class="u-tr">
					<u-th class="u-th">返沙人数</u-th>
					<u-th class="u-th">接种人数</u-th>
					<u-th class="u-th">购药人数</u-th>
				</u-tr>
				<u-tr class="u-tr">
					<u-td class="u-td">{{ list.count4 }}人</u-td>
					<u-td class="u-td">{{ list.count5 }}人</u-td>
					<u-td class="u-td">{{ list.count6 }}人</u-td>
				</u-tr>
			</u-table>
		</view>
		<view class="u-text-center u-margin-20 u-margin-top-50 u-font-lg">
			<text>历史总提交</text>
		</view>
		<view>
			<u-table>
				<u-tr class="u-tr">
					<u-th class="u-th">返沙人数</u-th>
					<u-th class="u-th">接种人数</u-th>
					<u-th class="u-th">购药人数</u-th>
				</u-tr>
				<u-tr class="u-tr">
					<u-td class="u-td">{{ list.count7 }}人</u-td>
					<u-td class="u-td">{{ list.count8 }}人</u-td>
					<u-td class="u-td">{{ list.count9 }}人</u-td>
				</u-tr>
			</u-table>
		</view>
		<view class="u-text-center u-margin-20 u-margin-top-50 u-font-lg">
			<text>社区疫苗接种次数排名</text>
		</view>
		<view>
			<u-table>
				<u-tr class="u-tr">
					<u-th class="u-th">社区名称</u-th>
					<u-th class="u-th">接种次数</u-th>
				</u-tr>
				<u-tr class="u-tr" v-for="item in list.rank">
					<u-td class="u-td">{{ item.name }}</u-td>
					<u-td class="u-td">{{ item.num }}次</u-td>
				</u-tr>
			</u-table>
		</view>
		<view>
			<u-toast ref="uToast" />
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				list: {
					count1: 0,
					count2: 0,
					count3: 0,
					count4: 0,
					count5: 0,
					count6: 0,
					rank: {}
				}
			}
		},
		methods: {
			async getStatisticsFunc(){
				const {
					code,
					msg,
					data
				} = await this.$u.api.getStatisticsList()
				if (code == 1) {
					this.list = data
				} else {
					this.$refs.uToast.show({
						title: msg,
						type: 'error',
					})
				}
			}
		},
		onShow() {
			this.getStatisticsFunc()
		}
	}
</script>

<style>
	
</style>
